package net.wds.ssbus.modules.dbconfig.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import net.wds.ssbus.common.utils.PageUtils;
import net.wds.ssbus.common.utils.R;

import net.wds.ssbus.modules.dbconfig.entity.TbDbSourceTypeEntity;
import net.wds.ssbus.modules.dbconfig.service.TbDbSourceTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 *  
 *
 * @author qsg
 * @email qsg@wdsrouce
 * @date 2020-10-22 11:41:56
 */
@RestController
@RequestMapping("dbconfig/tbdbsourcetype")
public class TbDbSourceTypeController {
    @Autowired
    private TbDbSourceTypeService tbDbSourceTypeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("ssbus:tbdbsourcetype:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbDbSourceTypeService.queryPage(params);

        return R.ok().put("page", page);
    }
    /**
     * 所有列表
     */
    @RequestMapping("/listall")
    //@RequiresPermissions("ssbus:tbdbsourcetype:list")
    public R listAll(){
        List<TbDbSourceTypeEntity> list = tbDbSourceTypeService.list();

        return R.ok().put("list", list);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("ssbus:tbdbsourcetype:info")
    public R info(@PathVariable("id") Integer id){
		TbDbSourceTypeEntity tbDbSourceType = tbDbSourceTypeService.getById(id);

        return R.ok().put("tbDbSourceType", tbDbSourceType);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("ssbus:tbdbsourcetype:save")
    public R save(@RequestBody TbDbSourceTypeEntity tbDbSourceType){
		tbDbSourceTypeService.save(tbDbSourceType);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("ssbus:tbdbsourcetype:update")
    public R update(@RequestBody TbDbSourceTypeEntity tbDbSourceType){
		tbDbSourceTypeService.updateById(tbDbSourceType);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("ssbus:tbdbsourcetype:delete")
    public R delete(@RequestBody Integer[] ids){
		tbDbSourceTypeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
